﻿var $items
var $lines
var classtargetFunction = function ($item) {
    clearclassFunction()


//    if ($items) {
//        
//        if ($items[0] == $item[0]) {
//            $items = null;
//            highlight($item)
//           
//        }
//        else {
//            highlight($item)
//        };
//    }
//    else {
        highlight($item)
//    }

    $lines = null;
};


var classlineFunction = function ($line) {
        clearclassFunction()
    
//    if ($lines) {
//        if ($lines.$startDiv[0] == $line.getlines().$startDiv[0]) {
//            $lines = null;
//            //$lines = ;
//            linehighlight($line.getlines())
//            clearclassFunction()
//         }
//        else {
//            $lines = $line.getlines();
//             linehighlight($lines)
//        };
//    }
//     else {
         
         linehighlight($line)
        
//     }
    $items = null;

};
var linehighlight = function ($line) {

    
    $lines = $line.getlines();
    $lines.$startDiv.css("background", "#333333")
    $lines.$endDiv.css("background", "#333333")
    $lines.$middleDiv.css("background", "#333333")
}
var highlight = function ($item) {
    $items = $item;
    $items.find('.leftEar, .topEar, .rightEar, .bottomEar').each(function () {

        var $this = $(this);
        $this.css("background", "#DDDDDD");
    });
    $items.find('.content').each(function () {

        var $this = $(this);
        $this.css("background-image", 'url("/Content/themes/blue/private/images/bg.editor.milestone2.gif")');
    });
    $items.find('.title,.contain1').each(function () {

        var $this = $(this);
        $this.css("background", '#DDDDDD');
    });
}
var clearclassFunction = function () {
    var allthelines = $("#container").attrFunctions('l', "all");
    for (var i = 0; i < allthelines.length; i++) {
        var line = allthelines[i].getlines();
        line.$startDiv.css("background", "#999999")
        line.$endDiv.css("background", "#999999")
        line.$middleDiv.css("background", "#999999")
    }
    var $container = $("#container");
    $container.find('.leftEar, .topEar, .rightEar, .bottomEar').each(function () {
        var $this = $(this);
        $this.css("background", "white");
    });
    $container.find('.content').each(function () {

        var $this = $(this);
        $this.css("background-image", 'url("/Content/themes/blue/private/images/bg.editor.milestone.gif")');

    });
    $container.find('.title,.contain1').each(function () {

        var $this = $(this);
        $this.css("background", 'white');
    });

}
var restartlineanditem = function () {

    $items = null
    $lines = null;
}